snippet libuv_timer "demo for timer" !b

static void repeat_close_cb(uv_handle_t* handle)
{
    printf("REPEAT_CLOSE_CB\n");
}

static void timer_repeat_cb(uv_timer_t* handle)
{
    assert(handle != NULL);
    assert(1 == uv_is_active((uv_handle_t*)handle));

	// user code

	/* quit the loop 
    if(condition)
    {
        uv_close((uv_handle_t*)handle, repeat_close_cb);
    }
	*/
}

// in main()
uv_timer_t once;
uv_timer_init(uv_default_loop(), &once);
uv_timer_start(&once, timer_repeat_cb, 100, 1000);  // 100毫秒之后第一次触发，之后的每1000毫秒触发一次
endsnippet


snippet libuv_udp_cliend_send "Description" !b

endsnippet

snippet libuv_read_file "Description" !b

endsnippet
